package pl.edu.mimuw.irs.core.model.design.processing;


/**
 * @author Jakub Rauch
 * Created on: 2009-05-07
 */
public class RoleInstance {

	// *** Attributes
	
	private Role role;
	private int units;
	// Getters and setters
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
	public int getUnits() {
		return units;
	}
	public void setUnits(int units) {
		this.units = units;
	}
	
	// *** Methods
	
	public RoleInstance(Role role, int units) {
		setRole(role);
		setUnits(units);
	}
	
	@Override
	public boolean equals(Object roleInstance) {
		if (roleInstance instanceof RoleInstance &&
				((RoleInstance)roleInstance).getRole().equals(getRole())) {
			return true;
		} else {
			return false;
		}
	}
	
	@Override
	public int hashCode() {
		return getRole().hashCode();
	}
	
	@Override
	public String toString() {
		return getRole().getName();
	}
}
